Index DATE | Batch


                                                                            

Batch Example -- DATE.BAT

-- Ver no 1: 24 lines and 779 bytes. 0 pipes. -- Used EXE: debug. -- Comments: Recursive. @ECHO OFF %1 %COMSPEC%/C%0 GOTO:SCRIPT > %temp%.\$.SCR debug.exe > %temp%.\$.BAT < %temp%.\$.SCR %COMSPEC%/C%0 GOTO:PREFIX %temp%.\$.BAT FOR %%C in (8 9 32) do SET C%%C= FOR %%C in (CAL DE) do %%CL %temp%.\$.BAT ECHO Day-Month-CenturyYear %C7%-%C8%-%C32%%C9% FOR %%C in (7 8 9 32 MDLINE) do SET C%%C= FOR %%C in (DEL GOTO:EOF) do %%C %temp%.\$.SCR :SCRIPT PROMPT o70,7$_i71$_o70,8$_i71$_o70,9$_i71$_o70,32$_i71$_q FOR %%C in (ECHO:ON ECHO:OFF GOTO:EOF) do %%C :PREFIX PROMPT CALL %0 GOTO:BAT = CTTY NUL %COMSPEC%/C %2>%temp%.\$.SCR TYPE %temp%.\$.SCR>%2 GOTO EOF :BAT IF -o70==%2 SET C%3=C%3 FOR %%- in (.-) do IF %%%2==.%2 GOTO EOF FOR %%C in (%C7% %C8% %C9% %C32%) do SET %%C=%2 :EOF Worth a closer look. So, put a blank line in line no 5, 7 and 10 (is better readable), then substitute: line no 26: FOR %%C in (%C7% %C8% %C9% %C32%) do SET %%C=%2 with: ECHO.FOR %%C in (%C7% %C8% %C9% %C32%) do SET %%C=%2 FOR %%C in (%C7% %C8% %C9% %C32%) do SET %%C=%2 and line no 8: FOR %%C in (8 9 32) do SET C%%C= with: FOR %%C in (8 9 32) do SET C%%C=C%%C Benny Pedersen, March 27, 2002. Links: Google News. PS. The above solution (Ver no 1), substitutes this old version, @echo off c: cd \ if exist temp\nul attrib +r temp if not exist temp\nul md temp cd temp echo o 70,7> file_D.scr echo o 70,8> file_M.scr echo o 70,9> file_Y.scr echo o 70,32> file_H.scr echo i 71>> file_D.scr echo i 71>> file_M.scr echo i 71>> file_Y.scr echo i 71>> file_H.scr echo q>> file_D.scr echo q>> file_M.scr echo q>> file_Y.scr echo q>> file_H.scr echo @set D=> file_D.txt echo @set M=> file_M.txt echo @set Y=> file_Y.txt echo @set H=> file_H.txt echo l102> file_all.scr for %%v in (w f100LFF''1A l w102 q) do echo %%v>> file_all.scr debug file_D.txt < file_all.scr > nul debug file_M.txt < file_all.scr > nul debug file_Y.txt < file_all.scr > nul debug file_H.txt < file_all.scr > nul type file_D.txt > file_D.bat type file_M.txt > file_M.bat type file_Y.txt > file_Y.bat type file_H.txt > file_H.bat debug nul < file_D.scr | find /v "-" >> file_D.bat debug nul < file_M.scr | find /v "-" >> file_M.bat debug nul < file_Y.scr | find /v "-" >> file_Y.bat debug nul < file_H.scr | find /v "-" >> file_H.bat copy file_D.bat + file_M.bat + file_Y.bat + file_H.bat get_date.bat > nul call get_date.bat echo. echo. (H)=(%H%), (Y)=(%Y%), (M)=(%M%), (D)=(%D%). echo. pause cls for %%v in (D M Y H) do set %%v= del file_*.* del get_date.bat cd .. attrib temp | find "R" > nul if errorlevel 1 if not exist temp\*.* rd temp
-Top- DATE | Batch